<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-weight: bold;color: #0099ff;font-size: 16px;">同步操作</span>
      </div> 
      <el-button @click="asyncYgxx" :disabled="btnflag" type="primary" plain>同步员工信息</el-button>
    </el-card>

    <el-card class="box-card" style="margin-top: 10px;" v-if="resInfo!=null">
      <div slot="header" class="clearfix">
        <span style="font-weight: bold;color: #0099ff;font-size: 16px;">同步结果</span>
      </div> 
      <span style="color:green"> {{ start }} </span><br /><br />
      <span style="color:red"> {{ resInfo }} </span><br /><br />
      <span style="color:green"> {{ end }} </span>
    </el-card>
    
  </div>
</template>
<script>
import { asyncYgxx } from "@/api/system/crm/crm";

export default {
  name: "Ygxx",
  data() {
    return {
      btnflag: false,
      resInfo: null,
      start:null,
      end:null
    };
  },
  created() {
    
  },
  methods: {
    asyncYgxx(){
        this.btnflag = true;
        asyncYgxx().then(res =>{
            if(res.code===200){
              this.$modal.msgSuccess("同步成功");
              this.btnflag = false;
              this.resInfo = res.data.data;
              this.start = res.data.start;
              this.end = res.data.end;
            }
        })
    },
  }
};
</script>